package com.larissa.android.note;

import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.ViewModelProvider;

import android.os.Bundle;
import android.view.View;

import com.larissa.android.note.databinding.ActivityCreateNoteBinding;

public class CreateNoteActivity extends AppCompatActivity {
    private static final String TAG="CreateNoteActivity";
    private CreateNoteViewModel mCreateNoteViewModel;
    private ActivityCreateNoteBinding mActivityCreateNoteBinding;
    private Note mNote;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mCreateNoteViewModel=new ViewModelProvider(this).get(CreateNoteViewModel.class);
        mActivityCreateNoteBinding=ActivityCreateNoteBinding.inflate(getLayoutInflater());
        setContentView(mActivityCreateNoteBinding.getRoot());
        mNote=new Note();
        mActivityCreateNoteBinding.setNote(mNote);

        mActivityCreateNoteBinding.btnCreateNote.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mCreateNoteViewModel.createNote(mNote);
            }
        });
    }
}